fix(api_core): clarify misleading http 404 unimplemented error message#17681
Conversation
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
Thanks! I edited the PR description to remove the alternative suggestion of raising
|
🤖 I have created a release *beep* *boop* --- <details><summary>google-api-core: 2.32.0</summary> ## [2.32.0](google-api-core-v2.31.0...google-api-core-v2.32.0) (2026-07-16) ### Features * implement PEP 0810 lazy loading in operations_v1 ([#17724](#17724)) ([22c5304](22c5304)) ### Bug Fixes * **api_core:** clarify misleading http 404 unimplemented error message ([#17681](#17681)) ([00b9040](00b9040)) </details> <details><summary>google-apps-chat: 0.10.3</summary> ## [0.10.3](google-apps-chat-v0.10.2...google-apps-chat-v0.10.3) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-batch: 0.22.1</summary> ## [0.22.1](google-cloud-batch-v0.22.0...google-cloud-batch-v0.22.1) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-bigtable: 2.41.0</summary> ## [2.41.0](google-cloud-bigtable-v2.40.0...google-cloud-bigtable-v2.41.0) (2026-07-16) ### Features * **bigtable:** support materialized views in the data client ([#17676](#17676)) ([2c3c213](2c3c213)) </details> <details><summary>google-cloud-compute: 1.50.0</summary> ## [1.50.0](google-cloud-compute-v1.49.0...google-cloud-compute-v1.50.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-compute-v1beta: 0.12.1</summary> ## [0.12.1](google-cloud-compute-v1beta-v0.12.0...google-cloud-compute-v1beta-v0.12.1) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-dialogflow: 2.51.0</summary> ## [2.51.0](google-cloud-dialogflow-v2.50.0...google-cloud-dialogflow-v2.51.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-discoveryengine: 0.20.2</summary> ## [0.20.2](google-cloud-discoveryengine-v0.20.1...google-cloud-discoveryengine-v0.20.2) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-kms: 3.16.0</summary> ## [3.16.0](google-cloud-kms-v3.15.0...google-cloud-kms-v3.16.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-memorystore: 0.5.3</summary> ## [0.5.3](google-cloud-memorystore-v0.5.2...google-cloud-memorystore-v0.5.3) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-secret-manager: 2.30.0</summary> ## [2.30.0](google-cloud-secret-manager-v2.29.0...google-cloud-secret-manager-v2.30.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-securitycenter: 1.46.0</summary> ## [1.46.0](google-cloud-securitycenter-v1.45.0...google-cloud-securitycenter-v1.46.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-shopping-merchant-inventories: 1.6.0</summary> ## [1.6.0](google-shopping-merchant-inventories-v1.5.0...google-shopping-merchant-inventories-v1.6.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-shopping-merchant-products: 1.8.0</summary> ## [1.8.0](google-shopping-merchant-products-v1.7.0...google-shopping-merchant-products-v1.8.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Summary of the issue:
Context:
When a gRPC call fails with grpc.StatusCode.UNIMPLEMENTED but the error details string includes "Received http2 header with status: 404", the google-api-core library currently translates this into google.api_core.exceptions.MethodNotImplemented. This scenario often happens due to client-side configuration errors like an incorrect api_endpoint or a malformed resource path, not because the method is actually unimplemented.
Actual Behavior:
The library raises google.api_core.exceptions.MethodNotImplemented: 501 Received http2 header with status: 404. This exception is misleading because the primary issue indicated by the underlying error is related to the 404 (Not Found), not that the method is unimplemented (501). This makes debugging difficult for users.
Expected Behavior:
google-api-core should raise an exception that better reflects the underlying HTTP 404. Suggested improvements:
Prioritize the 404 status when present in the details, raising google.api_core.exceptions.NotFound (404).
The goal is to provide a more actionable error message to the user, guiding them to check the endpoint or resource path.
Fixes - #17683